home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / mkdata.arc / DG.DAT next >
Text File  |  1991-04-28  |  29KB  |  634 lines

  1. program <PROCESS>;
  2. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3.   <PROCESS> : Generated by DataGen
  4.   Copyright (C) January, 1988
  5. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  6. uses crt, dos, TAccess, io;
  7.  
  8. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9.   <PROCESS> data structure definition section
  10. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  11. {$I <PROCESS>.typ}
  12. var     <PROCESS>_data   : <PROCESS>_structure;
  13.         <PROCESS>_file   : datafile;
  14. <IF_IX1>index1           : indexfile;
  15. <IF_IX2>index2           : indexfile;
  16. <IF_IX3>index3           : indexfile;
  17. <IF_IX4>index4           : indexfile;
  18. <IF_IX5>index5           : indexfile;
  19. <IF_IX6>index6           : indexfile;
  20. <IF_IX7>index7           : indexfile;
  21. <IF_IX8>index8           : indexfile;
  22. <IF_IX9>index9           : indexfile;
  23.  
  24. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  25.   <PROCESS> global variable declarations.
  26. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  27. const   NEW_<PROCESS> = -1;
  28. var     <PROCESS>_record : longint;
  29.         search_index : longint;
  30.  
  31.  
  32. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  33.   <PROCESS> screen definition file.
  34. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  35. {$I <PROCESS>.scr}
  36. {
  37. *-----------------------------------------------------------------------*
  38.                            function upper_case
  39. *-----------------------------------------------------------------------*
  40. }
  41. function upper_case(in_string : medium_string ) : medium_string;
  42. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  43.   Accepts lower case string, returns upper case string as value of the
  44.   function.
  45. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  46.  
  47. var  out_string : medium_string;
  48.      i          : byte;
  49.  
  50. begin
  51.      out_string := '';
  52.      for i := 1 to length( in_string ) do
  53.          out_string := out_string + upcase( in_string[i] );
  54.      upper_case := out_string;
  55. end; {function upper_case}
  56. {
  57. *-----------------------------------------------------------------------*
  58.                           procedure rebuild_index
  59. *-----------------------------------------------------------------------*
  60. }
  61. procedure rebuild_index;
  62. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  63.   Rebuilds the indices.
  64. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  65. var  record_number : longint;
  66.      key_to_add    : medium_string;
  67. begin
  68.  
  69.         initindex;
  70.         message('Building Index files...',1);
  71. <IF_IX1>makeindex( index1, '<PROCESS>.ix1', sizeof(<PROCESS>_data.<IX1>)-1, 1 );
  72. <IF_IX2>makeindex( index2, '<PROCESS>.ix2', sizeof(<PROCESS>_data.<IX2>)-1, 1 );
  73. <IF_IX3>makeindex( index3, '<PROCESS>.ix3', sizeof(<PROCESS>_data.<IX3>)-1, 1 );
  74. <IF_IX4>makeindex( index4, '<PROCESS>.ix4', sizeof(<PROCESS>_data.<IX4>)-1, 1 );
  75. <IF_IX5>makeindex( index5, '<PROCESS>.ix5', sizeof(<PROCESS>_data.<IX5>)-1, 1 );
  76. <IF_IX6>makeindex( index6, '<PROCESS>.ix6', sizeof(<PROCESS>_data.<IX6>)-1, 1 );
  77. <IF_IX7>makeindex( index7, '<PROCESS>.ix7', sizeof(<PROCESS>_data.<IX7>)-1, 1 );
  78. <IF_IX8>makeindex( index8, '<PROCESS>.ix8', sizeof(<PROCESS>_data.<IX8>)-1, 1 );
  79. <IF_IX9>makeindex( index9, '<PROCESS>.ix9', sizeof(<PROCESS>_data.<IX9>)-1, 1 );
  80.         for record_number := 1 to filelen(<PROCESS>_file) - 1 do begin
  81.               getrec(<PROCESS>_file,record_number,<PROCESS>_data);
  82.               if <PROCESS>_data.status = 0 then begin
  83. <IF_IX1>                   key_to_add := upper_case(<PROCESS>_data.<IX1>);
  84. <IF_IX1>                   addkey( index1, record_number, key_to_add );
  85. <IF_IX2>
  86. <IF_IX2>                   key_to_add := upper_case(<PROCESS>_data.<IX2>);
  87. <IF_IX2>                   addkey( index2, record_number, key_to_add);
  88. <IF_IX3>
  89. <IF_IX3>                   key_to_add := upper_case(<PROCESS>_data.<IX3>);
  90. <IF_IX3>                   addkey( index3, record_number, key_to_add);
  91. <IF_IX4>
  92. <IF_IX4>                   key_to_add := upper_case(<PROCESS>_data.<IX4>);
  93. <IF_IX4>                   addkey( index4, record_number, key_to_add);
  94. <IF_IX5>
  95. <IF_IX5>                   key_to_add := upper_case(<PROCESS>_data.<IX5>);
  96. <IF_IX5>                   addkey( index5, record_number, key_to_add);
  97. <IF_IX6>
  98. <IF_IX6>                   key_to_add := upper_case(<PROCESS>_data.<IX6>);
  99. <IF_IX6>                   addkey( index6, record_number, key_to_add);
  100. <IF_IX7>
  101. <IF_IX7>                   key_to_add := upper_case(<PROCESS>_data.<IX7>);
  102. <IF_IX7>                   addkey( index7, record_number, key_to_add);
  103. <IF_IX8>
  104. <IF_IX8>                   key_to_add := upper_case(<PROCESS>_data.<IX8>);
  105. <IF_IX8>                   addkey( index8, record_number, key_to_add);
  106. <IF_IX9>
  107. <IF_IX9>                   key_to_add := upper_case(<PROCESS>_data.<IX9>);
  108. <IF_IX9>                   addkey( index9, record_number, key_to_add);
  109.  
  110.               end; {if}
  111.       end; {for}
  112.       message('Index Files Rebuilt.',1);
  113. end   { rebuild_index };
  114.  
  115. {
  116. *-----------------------------------------------------------------------*
  117.                      procedure open_<PROCESS>                            
  118. *-----------------------------------------------------------------------*
  119. }
  120. function open_<PROCESS> : boolean;
  121. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  122.   Opens files and returns true, false if user wants to QUIT.             
  123. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  124. begin
  125. open_<PROCESS> := true;
  126. OpenFile( <PROCESS>_file, '<PROCESS>.dat', sizeof( <PROCESS>_data ));
  127. if not ok then begin
  128.        message('WELCOME TO <PROCESS>',1);
  129.        if get_menu('\1Yes\2Quit','',1,'\qFILES NOT FOUND, INITIALIZE? :') = 1 then begin
  130.          makefile( <PROCESS>_file, '<PROCESS>.dat',sizeof(<PROCESS>_data));
  131. <IF_IX1> makeindex( index1, '<PROCESS>.ix1',sizeof( <PROCESS>_data.<IX1>)-1,1);
  132. <IF_IX2> makeindex( index2, '<PROCESS>.ix2',sizeof( <PROCESS>_data.<IX2>)-1,1);
  133. <IF_IX3> makeindex( index3, '<PROCESS>.ix3',sizeof( <PROCESS>_data.<IX3>)-1,1);
  134. <IF_IX4> makeindex( index4, '<PROCESS>.ix4',sizeof( <PROCESS>_data.<IX4>)-1,1);
  135. <IF_IX5> makeindex( index5, '<PROCESS>.ix5',sizeof( <PROCESS>_data.<IX5>)-1,1);
  136. <IF_IX6> makeindex( index6, '<PROCESS>.ix6',sizeof( <PROCESS>_data.<IX6>)-1,1);
  137. <IF_IX7> makeindex( index7, '<PROCESS>.ix7',sizeof( <PROCESS>_data.<IX7>)-1,1);
  138. <IF_IX8> makeindex( index8, '<PROCESS>.ix8',sizeof( <PROCESS>_data.<IX8>)-1,1);
  139. <IF_IX9> makeindex( index9, '<PROCESS>.ix9',sizeof( <PROCESS>_data.<IX9>)-1,1);
  140.        end {if}
  141.        else open_<PROCESS> := false;
  142.        exit;
  143. end {if}
  144. else begin
  145. <IF_IX1> openindex(index1, '<PROCESS>.ix1', sizeof( <PROCESS>_data.<IX1>)-1,1 );
  146. <IF_IX2> openindex(index2, '<PROCESS>.ix2', sizeof( <PROCESS>_data.<IX2>)-1,1 );
  147. <IF_IX3> openindex(index3, '<PROCESS>.ix3', sizeof( <PROCESS>_data.<IX3>)-1,1 );
  148. <IF_IX4> openindex(index4, '<PROCESS>.ix4', sizeof( <PROCESS>_data.<IX4>)-1,1 );
  149. <IF_IX5> openindex(index5, '<PROCESS>.ix5', sizeof( <PROCESS>_data.<IX5>)-1,1 );
  150. <IF_IX6> openindex(index6, '<PROCESS>.ix6', sizeof( <PROCESS>_data.<IX6>)-1,1 );
  151. <IF_IX7> openindex(index7, '<PROCESS>.ix7', sizeof( <PROCESS>_data.<IX7>)-1,1 );
  152. <IF_IX8> openindex(index8, '<PROCESS>.ix8', sizeof( <PROCESS>_data.<IX8>)-1,1 );
  153. <IF_IX9> openindex(index9, '<PROCESS>.ix9', sizeof( <PROCESS>_data.<IX9>)-1,1 );
  154.  
  155. end; {else}
  156. end; {function open_<PROCESS>}
  157. {
  158. *-----------------------------------------------------------------------*
  159.                         procedure close_<PROCESS>                        
  160. *-----------------------------------------------------------------------*
  161. }
  162. procedure close_<PROCESS>;
  163. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  164.   closes the <PROCESS> data and index files.                             
  165. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  166. begin
  167.          closefile( <PROCESS>_file );
  168. <IF_IX1> closeindex( index1 );
  169. <IF_IX2> closeindex( index2 );
  170. <IF_IX3> closeindex( index3 );
  171. <IF_IX4> closeindex( index4 );
  172. <IF_IX5> closeindex( index5 );
  173. <IF_IX6> closeindex( index6 );
  174. <IF_IX7> closeindex( index7 );
  175. <IF_IX8> closeindex( index8 );
  176. <IF_IX9> closeindex( index9 );
  177. end; {procedure close_<PROCESS>}
  178. {
  179. *-----------------------------------------------------------------------*
  180.                      procedure retrieve_<PROCESS>
  181. *-----------------------------------------------------------------------*
  182. }
  183. procedure retrieve_<PROCESS>( param : byte ) ;
  184. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  185.   Brings in the next, previous, first, last record based on param.       
  186. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  187. var recnum        : longint;
  188.     key_to_search : long_string;
  189.  
  190. begin
  191.        if param in [1,2]  then case search_index of
  192. <IF_IX1>    <IXLOC1> : clearkey( index1 );
  193. <IF_IX2>    <IXLOC2> : clearkey( index2 );
  194. <IF_IX3>    <IXLOC3> : clearkey( index3 );
  195. <IF_IX4>    <IXLOC4> : clearkey( index4 );
  196. <IF_IX5>    <IXLOC5> : clearkey( index5 );
  197. <IF_IX6>    <IXLOC6> : clearkey( index6 );
  198. <IF_IX7>    <IXLOC7> : clearkey( index7 );
  199. <IF_IX8>    <IXLOC8> : clearkey( index8 );
  200. <IF_IX9>    <IXLOC9> : clearkey( index9 );
  201.        end; {case}
  202.  
  203.        if param in [1,3] then case search_index of
  204. <IF_IX1>      <IXLOC1>:   nextkey( index1, recnum, key_to_search );
  205. <IF_IX2>      <IXLOC2>:   nextkey( index2, recnum, key_to_search );
  206. <IF_IX3>      <IXLOC3>:   nextkey( index3, recnum, key_to_search );
  207. <IF_IX4>      <IXLOC4>:   nextkey( index4, recnum, key_to_search );
  208. <IF_IX5>      <IXLOC5>:   nextkey( index5, recnum, key_to_search );
  209. <IF_IX6>      <IXLOC6>:   nextkey( index6, recnum, key_to_search );
  210. <IF_IX7>      <IXLOC7>:   nextkey( index7, recnum, key_to_search );
  211. <IF_IX8>      <IXLOC8>:   nextkey( index8, recnum, key_to_search );
  212. <IF_IX9>      <IXLOC9>:   nextkey( index9, recnum, key_to_search );
  213.        end; {case}
  214.        if param in [2,4] then case search_index of
  215. <IF_IX1>      <IXLOC1>:   prevkey( index1, recnum, key_to_search );
  216. <IF_IX2>      <IXLOC2>:   prevkey( index2, recnum, key_to_search );
  217. <IF_IX3>      <IXLOC3>:   prevkey( index3, recnum, key_to_search );
  218. <IF_IX4>      <IXLOC4>:   prevkey( index4, recnum, key_to_search );
  219. <IF_IX5>      <IXLOC5>:   prevkey( index5, recnum, key_to_search );
  220. <IF_IX6>      <IXLOC6>:   prevkey( index6, recnum, key_to_search );
  221. <IF_IX7>      <IXLOC7>:   prevkey( index7, recnum, key_to_search );
  222. <IF_IX8>      <IXLOC8>:   prevkey( index8, recnum, key_to_search );
  223. <IF_IX9>      <IXLOC9>:   prevkey( index9, recnum, key_to_search );
  224.        end; {case}
  225.  
  226.        if ok then begin
  227.              getrec(<PROCESS>_file, recnum, <PROCESS>_data);
  228.              <PROCESS>_record := recnum;
  229.              <PROCESS>_screen('\2');
  230.        end {if}
  231.        else message('NO RECORD',1);
  232.  
  233.  
  234. end; {procedure retrieve_<PROCESS>}
  235. {
  236. *-----------------------------------------------------------------------*
  237.                     procedure find_<PROCESS>
  238. *-----------------------------------------------------------------------*
  239. }
  240. procedure find_<PROCESS>;
  241. var recnum        : longint;
  242.     key_to_search : long_string;
  243. begin
  244.       if usedrecs( <PROCESS>_file ) = 0 then begin
  245.                    message('ERROR : FILE IS EMPTY',2);
  246.                    exit;
  247.       end;
  248.       case get_menu('\1First\2Last\3Search\4Rebuild\5Exit',
  249.            '\1First Record\2Last Record\3Search by Index\4Rebuild Index files',1,'\qOPTION : ') of
  250.  
  251.       1:  retrieve_<PROCESS>(1);
  252.       2:  retrieve_<PROCESS>(2);
  253.       3:  begin
  254.                  fillchar(<PROCESS>_data, sizeof(<PROCESS>_data), 0);
  255.                  <PROCESS>_screen('\2\3\index');
  256.                  case search_index of
  257. <IF_IX1>         <IXLOC1> : begin key_to_search := upper_case(<PROCESS>_data.<IX1>);
  258. <IF_IX1>                          searchkey( index1, recnum, key_to_search);
  259. <IF_IX1>                    end;
  260. <IF_IX2>
  261. <IF_IX2>         <IXLOC2> : begin key_to_search := upper_case(<PROCESS>_data.<IX2>);
  262. <IF_IX2>                          searchkey( index2, recnum, key_to_search);
  263. <IF_IX2>                    end;
  264. <IF_IX3>
  265. <IF_IX3>         <IXLOC3> : begin key_to_search := upper_case(<PROCESS>_data.<IX3>);
  266. <IF_IX3>                          searchkey( index3, recnum, key_to_search);
  267. <IF_IX3>                    end;
  268. <IF_IX4>
  269. <IF_IX4>         <IXLOC4> : begin key_to_search := upper_case(<PROCESS>_data.<IX4>);
  270. <IF_IX4>                          searchkey( index4, recnum, key_to_search);
  271. <IF_IX4>                    end; 
  272. <IF_IX5>
  273. <IF_IX5>         <IXLOC5> : begin key_to_search := upper_case(<PROCESS>_data.<IX5>);
  274. <IF_IX5>                          searchkey( index5, recnum, key_to_search);
  275. <IF_IX5>                    end; 
  276. <IF_IX6>
  277. <IF_IX6>         <IXLOC6> : begin key_to_search := upper_case(<PROCESS>_data.<IX6>);
  278. <IF_IX6>                          searchkey( index6, recnum, key_to_search);
  279. <IF_IX6>                    end; 
  280. <IF_IX7>
  281. <IF_IX7>         <IXLOC7> : begin key_to_search := upper_case(<PROCESS>_data.<IX7>);
  282. <IF_IX7>                          searchkey( index7, recnum, key_to_search);
  283. <IF_IX7>                    end;
  284. <IF_IX8>
  285. <IF_IX8>         <IXLOC8> : begin key_to_search := upper_case(<PROCESS>_data.<IX8>);
  286. <IF_IX8>                          searchkey( index8, recnum, key_to_search);
  287. <IF_IX8>                    end; 
  288. <IF_IX9>
  289. <IF_IX9>         <IXLOC9> : begin key_to_search := upper_case(<PROCESS>_data.<IX9>);
  290. <IF_IX9>                          searchkey( index9, recnum, key_to_search);
  291. <IF_IX9>                    end; 
  292.  
  293.                  end; {case}
  294.                  if ok then begin
  295.                          getrec( <PROCESS>_file, recnum, <PROCESS>_data);
  296.                          <PROCESS>_record := recnum;
  297.                          <PROCESS>_screen('\2');
  298.                  end {if}
  299.                  else retrieve_<PROCESS>(2);
  300.       end; {case 3}
  301.       4:      rebuild_index;
  302.       5:      ;
  303.  
  304.       end; {case}
  305. end; {procedure find_<PROCESS>}
  306.  
  307. {
  308. *---------------------------------------------------------------------*
  309.                       procedure fill_<PROCESS>                         
  310. *---------------------------------------------------------------------*
  311. }
  312. function fill_<PROCESS> : byte;
  313. var       select : integer;
  314.           <PROCESS>_save : <PROCESS>_structure;
  315. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  316.   Allows the user to Alter the contents of a passed <PROCESS> record.  
  317. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  318. begin
  319. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  320.   Save the old record in case they cancel session.
  321. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  322.         <PROCESS>_save := <PROCESS>_data;
  323.  
  324. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  325.   New record? blank out the data structure.
  326. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  327.         if <PROCESS>_record = NEW_<PROCESS> then begin
  328.                 fillchar( <PROCESS>_data, sizeof( <PROCESS>_data ), 0 );
  329.                 <PROCESS>_screen( '\2' );    {blank out the fields}
  330.         end; {if}
  331.         <PROCESS>_screen('\3');           {permit filling of fields}
  332.  
  333. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  334.   Permit the user to fill the <PROCESS> structure.
  335. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  336.         select :=2;
  337.         repeat
  338.                 select := get_menu('\1Edit\2Save\3Cancel',
  339.                 '\1Edit Screen Information\2Save Data\3Cancel & Return',
  340.                 select, '\qEDIT OPTION: ');
  341.  
  342.                 fill_<PROCESS> := select;
  343.  
  344.                 case select of
  345.                 1: <PROCESS>_screen('\3');
  346.                 2: exit;
  347.                 3: begin
  348.                         <PROCESS>_data := <PROCESS>_save;
  349.                         <PROCESS>_screen('\2');
  350.                         exit;
  351.                    end;
  352.                 end; {case}
  353.  
  354.         until false;
  355.  
  356. end; {procedure fill_<PROCESS>}
  357. {
  358. *-----------------------------------------------------------------------*
  359.                          procedure delete_<PROCESS>                      
  360. *-----------------------------------------------------------------------*
  361. }
  362. procedure delete_<PROCESS>;
  363. var key_to_delete : medium_string;
  364.  
  365. begin
  366.      if <PROCESS>_record = NEW_<PROCESS> then begin
  367.                      message('Please Select a Record for Deletion',2);
  368.                      exit;
  369.      end;
  370.      if get_menu('\1Yes\2Cancel','',1,'\qDELETE CURRENT RECORD? : ') = 1
  371.      then begin
  372. <IF_IX1>       key_to_delete := upper_case(<PROCESS>_data.<IX1>);
  373. <IF_IX1>       deletekey( index1, <PROCESS>_record, key_to_delete);
  374. <IF_IX2>
  375. <IF_IX2>       key_to_delete := upper_case(<PROCESS>_data.<IX2>);
  376. <IF_IX2>       deletekey( index2, <PROCESS>_record, key_to_delete);
  377. <IF_IX3>
  378. <IF_IX3>       key_to_delete := upper_case(<PROCESS>_data.<IX3>);
  379. <IF_IX3>       deletekey( index3, <PROCESS>_record, key_to_delete);
  380. <IF_IX4>
  381. <IF_IX4>       key_to_delete := upper_case(<PROCESS>_data.<IX4>);
  382. <IF_IX4>       deletekey( index4, <PROCESS>_record, key_to_delete);
  383. <IF_IX5>
  384. <IF_IX5>       key_to_delete := upper_case(<PROCESS>_data.<IX5>);
  385. <IF_IX5>       deletekey( index5, <PROCESS>_record, key_to_delete);
  386. <IF_IX6>
  387. <IF_IX6>       key_to_delete := upper_case(<PROCESS>_data.<IX6>);
  388. <IF_IX6>       deletekey( index6, <PROCESS>_record, key_to_delete);
  389. <IF_IX7>
  390. <IF_IX7>       key_to_delete := upper_case(<PROCESS>_data.<IX7>);
  391. <IF_IX7>       deletekey( index7, <PROCESS>_record, key_to_delete);
  392. <IF_IX8>
  393. <IF_IX8>       key_to_delete := upper_case(<PROCESS>_data.<IX8>);
  394. <IF_IX8>       deletekey( index8, <PROCESS>_record, key_to_delete);
  395. <IF_IX9>
  396. <IF_IX9>       key_to_delete := upper_case(<PROCESS>_data.<IX9>);
  397. <IF_IX9>       deletekey( index9, <PROCESS>_record, key_to_delete);
  398.  
  399.                deleterec( <PROCESS>_file, <PROCESS>_record );
  400.                message('Deleted...',1);
  401.                <PROCESS>_record := NEW_<PROCESS>;
  402.                if usedrecs( <PROCESS>_file ) = 0 then begin
  403. <IF_IX1>               clearkey( index1 );
  404. <IF_IX2>               clearkey( index2 );
  405. <IF_IX3>               clearkey( index3 );
  406. <IF_IX4>               clearkey( index4 );
  407. <IF_IX5>               clearkey( index5 );
  408. <IF_IX6>               clearkey( index6 );
  409. <IF_IX7>               clearkey( index7 );
  410. <IF_IX8>               clearkey( index8 );
  411. <IF_IX9>               clearkey( index9 );
  412.  
  413.                        fillchar( <PROCESS>_data, sizeof( <PROCESS>_data ), 0);
  414.                        <PROCESS>_screen('\2');
  415.                        message('FILE IS EMPTY',1);
  416.                end {if}
  417.                else retrieve_<PROCESS>(1);
  418.      end; {if}
  419. end; {procedure delete_<PROCESS>}
  420.  
  421. {
  422. *-----------------------------------------------------------------------*
  423.                        procedure add_<PROCESS>
  424. *-----------------------------------------------------------------------*
  425. }
  426. procedure add_<PROCESS>;
  427. var key_string        : medium_string;
  428.     recnum            : longint;
  429.     save_<PROCESS>_record : longint;
  430.     key_to_add        : medium_string;
  431.  
  432. begin
  433.      save_<PROCESS>_record := <PROCESS>_record;
  434.      <PROCESS>_record := NEW_<PROCESS>;
  435.  
  436.      if fill_<PROCESS> = 3 then
  437.                     <PROCESS>_record := save_<PROCESS>_record
  438.      else begin
  439.                     addrec( <PROCESS>_file, recnum, <PROCESS>_data );
  440.                     <PROCESS>_record := recnum;
  441. <IF_IX1>            key_to_add := upper_case(<PROCESS>_data.<IX1>);
  442. <IF_IX1>            addkey( index1, recnum, key_to_add );
  443. <IF_IX2>
  444. <IF_IX2>            key_to_add := upper_case(<PROCESS>_data.<IX2>);
  445. <IF_IX2>            addkey( index2, recnum, key_to_add );
  446. <IF_IX3>
  447. <IF_IX3>            key_to_add := upper_case(<PROCESS>_data.<IX3>);
  448. <IF_IX3>            addkey( index3, recnum, key_to_add );
  449. <IF_IX4>
  450. <IF_IX4>            key_to_add := upper_case(<PROCESS>_data.<IX4>);
  451. <IF_IX4>            addkey( index4, recnum, key_to_add );
  452. <IF_IX5>
  453. <IF_IX5>            key_to_add := upper_case(<PROCESS>_data.<IX5>);
  454. <IF_IX5>            addkey( index5, recnum, key_to_add );
  455. <IF_IX6>
  456. <IF_IX6>            key_to_add := upper_case(<PROCESS>_data.<IX6>);
  457. <IF_IX6>            addkey( index6, recnum, key_to_add );
  458. <IF_IX7>
  459. <IF_IX7>            key_to_add := upper_case(<PROCESS>_data.<IX7>);
  460. <IF_IX7>            addkey( index7, recnum, key_to_add );
  461. <IF_IX8>
  462. <IF_IX8>            key_to_add := upper_case(<PROCESS>_data.<IX8>);
  463. <IF_IX8>            addkey( index8, recnum, key_to_add );
  464. <IF_IX9>
  465. <IF_IX9>            key_to_add := upper_case(<PROCESS>_data.<IX9>);
  466. <IF_IX9>            addkey( index9, recnum, key_to_add );
  467.  
  468.                     <PROCESS>_screen('\2');
  469.      end; {else}
  470. end; {procedure add_<PROCESS>}
  471. {
  472. *-----------------------------------------------------------------------*
  473.                            procedure edit_<PROCESS>                      
  474. *-----------------------------------------------------------------------*
  475. }
  476. procedure edit_<PROCESS>;
  477. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  478.   Allows the user to edit a <PROCESS>.                                   
  479. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  480.  
  481. var
  482. <IF_IX1>      save_<IX1>              : medium_string;
  483. <IF_IX2>      save_<IX2>              : medium_string;
  484. <IF_IX3>      save_<IX3>              : medium_string;
  485. <IF_IX4>      save_<IX4>              : medium_string;
  486. <IF_IX5>      save_<IX5>              : medium_string;
  487. <IF_IX6>      save_<IX6>              : medium_string;
  488. <IF_IX7>      save_<IX7>              : medium_string;
  489. <IF_IX8>      save_<IX8>              : medium_string;
  490. <IF_IX9>      save_<IX9>              : medium_string;
  491.               work_key                : medium_string;
  492.  
  493. begin
  494.       if <PROCESS>_record <> NEW_<PROCESS> then begin
  495. <IF_IX1>      save_<IX1> := <PROCESS>_data.<IX1>;
  496. <IF_IX2>      save_<IX2> := <PROCESS>_data.<IX2>;
  497. <IF_IX3>      save_<IX3> := <PROCESS>_data.<IX3>;
  498. <IF_IX4>      save_<IX4> := <PROCESS>_data.<IX4>;
  499. <IF_IX5>      save_<IX5> := <PROCESS>_data.<IX5>;
  500. <IF_IX6>      save_<IX6> := <PROCESS>_data.<IX6>;
  501. <IF_IX7>      save_<IX7> := <PROCESS>_data.<IX7>;
  502. <IF_IX8>      save_<IX8> := <PROCESS>_data.<IX8>;
  503. <IF_IX9>      save_<IX9> := <PROCESS>_data.<IX9>;
  504.         if fill_<PROCESS> = 2 then
  505.               putrec(<PROCESS>_file, <PROCESS>_record, <PROCESS>_data);
  506.  
  507. <IF_IX1>if upper_case(save_<IX1>) <> upper_case(<PROCESS>_data.<IX1>) then begin
  508. <IF_IX1>      work_key := upper_case( save_<IX1> );
  509. <IF_IX1>      deletekey( index1, <PROCESS>_record, work_key );
  510. <IF_IX1>      work_key := upper_case( <PROCESS>_data.<IX1> );
  511. <IF_IX1>      addkey( index1, <PROCESS>_record, work_key);
  512. <IF_IX1>end; {if}
  513. <IF_IX2>
  514. <IF_IX2>if upper_case(save_<IX2>) <> upper_case(<PROCESS>_data.<IX2>) then begin
  515. <IF_IX2>      work_key := upper_case( save_<IX2> );
  516. <IF_IX2>      deletekey( index2, <PROCESS>_record, work_key );
  517. <IF_IX2>      work_key := upper_case( <PROCESS>_data.<IX2> );
  518. <IF_IX2>      addkey( index2, <PROCESS>_record, work_key);
  519. <IF_IX2>end; {if}
  520. <IF_IX3>
  521. <IF_IX3>if upper_case(save_<IX3>) <> upper_case(<PROCESS>_data.<IX3>) then begin
  522. <IF_IX3>      work_key := upper_case( save_<IX3> );
  523. <IF_IX3>      deletekey( index3, <PROCESS>_record, work_key );
  524. <IF_IX3>      work_key := upper_case( <PROCESS>_data.<IX3> );
  525. <IF_IX3>      addkey( index3, <PROCESS>_record, work_key);
  526. <IF_IX3>end; {if}
  527. <IF_IX4>
  528. <IF_IX4>if upper_case(save_<IX4>) <> upper_case(<PROCESS>_data.<IX4>) then begin
  529. <IF_IX4>      work_key := upper_case( save_<IX4> );
  530. <IF_IX4>      deletekey( index4, <PROCESS>_record, work_key );
  531. <IF_IX4>      work_key := upper_case( <PROCESS>_data.<IX4> );
  532. <IF_IX4>      addkey( index4, <PROCESS>_record, work_key);
  533. <IF_IX4>end; {if}
  534. <IF_IX5>
  535. <IF_IX5>if upper_case(save_<IX5>) <> upper_case(<PROCESS>_data.<IX5>) then begin
  536. <IF_IX5>      work_key := upper_case( save_<IX5> );
  537. <IF_IX5>      deletekey( index5, <PROCESS>_record, work_key );
  538. <IF_IX5>      work_key := upper_case( <PROCESS>_data.<IX5> );
  539. <IF_IX5>      addkey( index5, <PROCESS>_record, work_key);
  540. <IF_IX5>end; {if}
  541. <IF_IX6>
  542. <IF_IX6>if upper_case(save_<IX6>) <> upper_case(<PROCESS>_data.<IX6>) then begin
  543. <IF_IX6>      work_key := upper_case( save_<IX6> );
  544. <IF_IX6>      deletekey( index6, <PROCESS>_record, work_key );
  545. <IF_IX6>      work_key := upper_case( <PROCESS>_data.<IX6> );
  546. <IF_IX6>      addkey( index6, <PROCESS>_record, work_key);
  547. <IF_IX6>end; {if}
  548. <IF_IX7>
  549. <IF_IX7>if upper_case(save_<IX7>) <> upper_case(<PROCESS>_data.<IX7>) then begin
  550. <IF_IX7>      work_key := upper_case( save_<IX7> );
  551. <IF_IX7>      deletekey( index7, <PROCESS>_record, work_key );
  552. <IF_IX7>      work_key := upper_case( <PROCESS>_data.<IX7> );
  553. <IF_IX7>      addkey( index7, <PROCESS>_record, work_key);
  554. <IF_IX7>end; {if}
  555. <IF_IX8>
  556. <IF_IX8>if upper_case(save_<IX8>) <> upper_case(<PROCESS>_data.<IX8>) then begin
  557. <IF_IX8>      work_key := upper_case( save_<IX8> );
  558. <IF_IX8>      deletekey( index8, <PROCESS>_record, work_key );
  559. <IF_IX8>      work_key := upper_case( <PROCESS>_data.<IX8> );
  560. <IF_IX8>      addkey( index8, <PROCESS>_record, work_key);
  561. <IF_IX8>end; {if}
  562. <IF_IX9>
  563. <IF_IX9>if upper_case(save_<IX9>) <> upper_case(<PROCESS>_data.<IX9>) then begin
  564. <IF_IX9>      work_key := upper_case( save_<IX9> );
  565. <IF_IX9>      deletekey( index9, <PROCESS>_record, work_key );
  566. <IF_IX9>      work_key := upper_case( <PROCESS>_data.<IX9> );
  567. <IF_IX9>      addkey( index9, <PROCESS>_record, work_key);
  568. <IF_IX9>end; {if}
  569.  
  570.       end {if}
  571.       else message('Please Select a Record for Editing',2);
  572. end; {procedure edit_<PROCESS>}
  573. {
  574. *---------------------------------------------------------------------*
  575.                 MAIN CODE FOR procedure maintain_<PROCESS>             
  576. *---------------------------------------------------------------------*
  577. }
  578. var     select : integer;
  579.  
  580. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  581.   Supervisory routine for <PROCESS> maintenance routines.
  582. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  583. begin
  584. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  585.   Initialize System and Database.
  586. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  587.         set_system;
  588.  
  589. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  590.   Show them a blank entry screen.                                      
  591. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  592. <IF_IX1>search_index := <IXLOC1>;
  593.         clrscr;
  594.         if not open_<PROCESS> then begin
  595.                               set_cursor(1);
  596.                               exit;
  597.         end; {if}
  598.         <PROCESS>_record := NEW_<PROCESS>;
  599.         fillchar( <PROCESS>_data, sizeof( <PROCESS>_data ), 0);
  600.  
  601.         <PROCESS>_screen('\1\2');
  602.         message('<PROCESS> : Alared Software / 1650 Lexington Avenue / Lakewood, NJ 08701',1);
  603.  
  604. { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  605.   Give them the <PROCESS> Menu.
  606. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  607.         select := 1;
  608.  
  609.         repeat
  610.                 select := get_menu( '\1Add\2Edit\3Delete\4Next\5Previous'+
  611.                 '\6Find\7Quit',
  612.                 '\1Add Record\2Edit Record\3Delete Record'+
  613.                 '\6First, Last, Search\7Exit to DOS',
  614.                 select, '\qOPTION: ');
  615.  
  616.         case select of
  617.         1:      add_<PROCESS>;
  618.         2:      edit_<PROCESS>;
  619.         3:      delete_<PROCESS>;
  620.         4:      retrieve_<PROCESS>(3);
  621.         5:      retrieve_<PROCESS>(4);
  622.         6:      find_<PROCESS>;
  623.         7:      begin   close_<PROCESS>;
  624.                         clrscr;
  625.                         gotoxy(homex, endscry);
  626.                         set_cursor(1);
  627.                         exit;
  628.                 end;
  629.         end; {case}
  630.  
  631.         until false;
  632.  
  633. end. {program <PROCESS>}
  634.